import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
void main() {
  runApp(MyApp());
}
class MyApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      home:HomePage(),
    );
  }

}
bool IsClick = true;
class HomePage extends StatefulWidget {
  @override
  HomePageState createState() => new HomePageState();
}

class HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {

    return  Scaffold(
      backgroundColor: Color.fromRGBO(236,236,236, 1),
      appBar: AppBar(
        backgroundColor: Color.fromRGBO(51, 51, 51, 1),
        titleSpacing: 0.0,
        title:Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            FlatButton(
              materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
              child: Row(
                children: [
                  Icon(Icons.arrow_back_ios,color: Colors.white,),
                  Text('返回',style: TextStyle(color: Colors.white,fontSize: 16),)
                ],
              ),
              onPressed:(){},
            ),
            Container(child: Row(children: [
              Text('跑腿待付款详情',style: TextStyle(fontSize: 16),),
              SizedBox(width: 25,)
            ],),),
            IconButton(icon: Icon(Icons.more_horiz), onPressed: (){})
          ],
        ),
        bottom: PreferredSize(
          preferredSize: Size.fromHeight(90),
          child: Column(
            children: <Widget>[
              //任务已被接单
              Container(
                height: 80,
                padding: EdgeInsets.only(left: 15,top: 10,bottom: 10),
                color: Colors.white,
                child: Row(
                  children: <Widget>[
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: <Widget>[
                        Text("任务已被接单",style: TextStyle(fontSize: 16,fontWeight: FontWeight.bold)),
                        SizedBox(height: 8,),
                        Text("接单时间：2017-6-20 18:00",style: TextStyle(fontSize: 16))
                      ],
                    )
                  ],
                ),
              ),
              Container(
                height: 10,
                decoration: BoxDecoration(
                  color: Color.fromRGBO(236,236,236, 1),
                ),
              )
            ],
          ),
          // preferredSize: Size.fromHeight(80.0)
        ),
      ),
      body: Container(
        child: Column(
          children: <Widget>[
            Expanded(
              child: SingleChildScrollView(
                child: Column(
                  children: <Widget>[

                    SizedBox(height: 10,),
                    //跑腿待付款（金额内容地址）
                    Container(
                      padding: EdgeInsets.only(left: 15,right: 15,top:10 ,bottom: 10),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[

                          //跑腿待付款
                          Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: <Widget>[
                              Text("跑腿",style: TextStyle(fontSize: 14),),
                              Spacer(),
                              Text("待确认",style: TextStyle(fontSize: 16),textAlign: TextAlign.right,)
                            ],
                          ),
                          SizedBox(height: 10,),
                          Text("任务主题（限制20字）",style: TextStyle(fontSize: 18),),
                          SizedBox(height: 20,),
                          //分割线
                          Divider(color: Color.fromRGBO(51, 51, 51, 0.5)),
                          //已支付
                          Row(
                            children: <Widget>[

                              Icon(Icons.attach_money,color:Color.fromRGBO(51, 51, 51, 0.5),),

                              Text("  已支付：5元",style: TextStyle(fontSize: 16))
                            ],
                          ),
                          SizedBox(height: 10,),
                          //任务内容
                          Container(
                            width: 300,
                            child: Row(
                              children: <Widget>[
                                Icon(Icons.message,color:Color.fromRGBO(51, 51, 51, 0.5),),
                                Expanded(
                                  child: Padding(
                                    padding: EdgeInsets.only(left: 10,top: 12),
                                    child: Text('任务内容任务内容任务内容任务内容任务内容任务内容任务内容任务内容',style: TextStyle(fontSize: 16),),
                                  ),
                                ),
                              ],
                            ),
                          ),
                          SizedBox(height: 20,),
                          //分割线
                          Divider(color: Color.fromRGBO(51, 51, 51, 0.5)),
                          //发单人姓名地址电话
                          Row(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              Icon(Icons.location_on,color:Color.fromRGBO(51, 51, 51, 0.5),),
                              Text("  发单人姓名         15688888888  ",style: TextStyle(fontSize: 16)),
                            ],
                          ),
                          SizedBox(height: 8,),
                          Text("          福建省厦门市",style: TextStyle(fontSize: 13)),
                          SizedBox(height: 30,),
                          //分割线
                          Divider(color: Color.fromRGBO(51, 51, 51, 0.5)),
                          SizedBox(height: 8,),
                          //  发布时间
                          Row(
                            children: <Widget>[

                              Icon(Icons.access_time,color:Color.fromRGBO(51, 51, 51, 0.5),),

                              Text("  发布时间：2017-6-20 18:00",style: TextStyle(fontSize: 16))
                            ],
                          ),
                          SizedBox(height: 10,),
                        ],
                      ),

                      decoration: BoxDecoration(
                          color: Colors.white
                      ),
                    ),
                    SizedBox(height: 10,),
                    //接单信息
                    Container(
                      padding: EdgeInsets.only(left: 15,right: 15,top:10 ,bottom: 10),
                      decoration: BoxDecoration(
                          color: Colors.white
                      ),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Text("  接单信息",style: TextStyle(fontSize: 16)),
                          Divider(color: Color.fromRGBO(51, 51, 51, 0.5)),
                          Row(
                            children: <Widget>[
                              Icon(Icons.account_circle,color:Color.fromRGBO(51, 51, 51, 0.5),),
                              Text("  接单人姓名             13988888888",style: TextStyle(fontSize: 16)),
                            ],
                          ),
                          Divider(color: Color.fromRGBO(51, 51, 51, 0.5)),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: <Widget>[
                              Icon(Icons.phone,color:Color.fromRGBO(51, 51, 51, 0.5),size: 30,),
                              Text("  电话接单人",style: TextStyle(fontSize: 16)),
                            ],
                          ),
                          Divider(color: Color.fromRGBO(51, 51, 51, 0.5)),
                          Row(
                            children: <Widget>[

                              Icon(Icons.access_time,color:Color.fromRGBO(51, 51, 51, 0.5),),

                              Text("  接单时间：2017-6-20 18:00",style: TextStyle(fontSize: 16))
                            ],
                          )
                        ],
                      ),
                    )
                  ],
                ),
              ),
            ),
            //取消订单 确认完成!!!按钮
            Container(
              height: 50,
              decoration: BoxDecoration(
                  border: Border(top: BorderSide(color: Colors.grey,width: 1)),
                  color: Colors.white
              ),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  RaisedButton(
                    color: Color.fromRGBO(215,215,215,1),
                    disabledColor: Colors.blue,
                    disabledTextColor: Colors.white,
                    onPressed: (){
                      return null;
                    },
                    child: new Text('取消订单',style: TextStyle(color: Colors.white),),
                    shape: BeveledRectangleBorder(borderRadius: BorderRadius.circular(3.0),
                    ),

                  ),
                  Text("   "),
                  MaterialButton(
                      color: Colors.grey,
                      child: new Text('确认完成',style: TextStyle(color: Colors.white),),
                      shape: BeveledRectangleBorder(borderRadius: BorderRadius.circular(3.0),),
                      onPressed: (){
                        showDialog(
                            context:context,
                            barrierDismissible: false,
                            builder: (BuildContext context){
                              return TureDialog();
                            }
                        );
                      }
                  ),
                  Text("   ")
                ],
              ),

            ),
          ],
        ),
      ),
    );
  }
}
//确认完成提示弹窗
class TureDialog extends StatefulWidget {
  @override
  TureDialogState createState() => new TureDialogState();
}

class TureDialogState extends State<TureDialog> {
  @override
  Widget build(BuildContext context) {
    return Material(
      //创建透明层
      type: MaterialType.transparency, //透明类型
      child: new Center(
        //保证控件居中效果
        child: new SizedBox(
          width: 320.0,
          height: 200.0,
          child: Container(
            decoration: BoxDecoration(
                border: new Border.all(color: Colors.black, width: 0.5),
                color: Colors.white),
            child: Column(
              children: <Widget>[
                SizedBox(height: 10,),
                Text("成功提示",style: TextStyle(fontSize: 16),),
                SizedBox(height: 40,),
                Padding(
                    padding: EdgeInsets.only(left: 15,right: 15),
                    child: Center(
                      child: Text("是否确认完成该单？",style: TextStyle(fontSize: 20),textAlign: TextAlign.center,),
                    )
                ),

                Spacer(),
                Row(
                  children: <Widget>[
                    Expanded(
                      child: Container(
                        child: Center(
                          child: FlatButton(
                            highlightColor:Color.fromRGBO(255,255,255,0),
                            child: Text("确认完成"),
                            onPressed: (){
                              null;
                            },
                          ),
                        ),
                        decoration: BoxDecoration(
                          border: new Border.all(color: Colors.black, width: 0.5),
                        ),
                      ),
                    )
                    ,
                    Expanded(
                      child: Container(
                        child: Center(
                          child: FlatButton(
                            highlightColor:Color.fromRGBO(255,255,255,0),
                            child: Text("取消"),
                            onPressed: (){
                              Navigator.pop(context);
                            },
                          ),
                        ),
                        decoration: BoxDecoration(
                          border: new Border.all(color: Colors.black, width: 0.5),
                        ),
                      ),
                    )
                  ],
                ),

              ],
            ),
          ),
        ),
      ),
    );
  }
}



